import io.micrometer.prometheus.PrometheusMeterRegistry;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class PrometheusEndpoint {
    private final PrometheusMeterRegistry prometheusMeterRegistry;

    @Autowired
    public PrometheusEndpoint(PrometheusMeterRegistry prometheusMeterRegistry) {
        this.prometheusMeterRegistry = prometheusMeterRegistry;
    }
    @GetMapping("/actuator/prometheus")
    public String scrape() {
        return prometheusMeterRegistry.scrape();
    }
}